package example;

import com.ceiec.cad.util.DateUtils;

public class EmailTest {
    public static void main(String[] args) throws Exception {
        sendEmail("test hah", "");
    }


    public static void sendEmail(String content, String title) throws Exception {
        String userName = "914000408@qq.com"; // 发件人邮箱
        String password = "pjwzdgkptzpibech"; // 发件人密码
        String smtpHost = "smtp.qq.com"; // 邮件服务器

        String to = "1801396648@qq.com,914000408@qq.com"; // 收件人，多个收件人以半角逗号分隔
//        String to = "914000408@qq.com"; // 收件人，多个收件人以半角逗号分隔
//        String cc = "914000408@qq.com"; // 抄送，多个抄送以半角逗号分隔
//        String to = "914000408@qq.com"; // 抄送，多个抄送以半角逗号分隔
//        String subject = "[" + DateUtils.getToday() + "]宝宝可转债," + title; // 主题
        String subject = title; // 主题
        String body = "这是邮件的正文"; // 正文，可以用html格式的哟
//        List<String> attachments = Arrays.asList("F:\\三屏演示机器相关脚本\\sendmail.py"); // 附件的路径，多个附件也不怕

//        Email email = Email.entity(smtpHost, userName, password, to, cc, subject, body, attachments);
        Email email = Email.entity(smtpHost, userName, password, to, null, subject, content, null);

        email.send(); // 发送！
    }
}
